package com.xbai.springcloud.controller;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author xbai
 * @Date 2021/5/15
 */
@RestController
@Slf4j
@RequestMapping("/consumer")
@RequiredArgsConstructor
public class OrderControllerController {

    private static final String INVOKE_URL = "http://cloud-consul-provider-payment";

    private final RestTemplate restTemplate;

    @GetMapping("/payment/consul")
    public String paymentInfo() {
        return restTemplate.getForObject(INVOKE_URL + "/payment/consul", String.class);
    }
}
